package com.lywz.biz.common.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * @author zhouxc may
 * @date   2010-5-1
 * @tag    
 * 
 * 添加valueOf方法
 * @author lionel pang
 * @date 2010-05-05
 */
public enum City {
    guiyang(1,"贵阳"),		//
    liupanshui(2,"六盘水"),	//
    zunyi(3,"遵义"),		//
    anshun(4,"安顺"),	//
    tongren(5,"铜仁"),	//
    qianxinan(6,"黔西南布依族苗族自治州"),	//
    bijie(7,"毕节"),		//
    qiandongnan(8,"黔东南苗族侗族自治州"),	//
    qiannan(9,"黔南布依族苗族自治州");	//
    
    
    public final int cityId;	// 城市ID
    public final String cityName;	// 城市名称
    
    public int getCityId() {
        return cityId;
    }

    
    public String getCityName() {
        return cityName;
    }

    // 常量缓冲
    private static Map<Integer, City> constantsMap;
    private static List<City> cityCollection;
    
    static{
    	constantsMap = new HashMap<Integer, City>();
    	cityCollection = new ArrayList<City>();
		for(City c : City.values()){
			cityCollection.add(c);
			constantsMap.put(c.getCityId(), c);
		}
    }
    
    public static City valueOfById(int cityId) {
        return constantsMap.get(cityId);
    }
    
    public static List<City> getCityList(){
        return cityCollection;
    }
    
    private City(int cityId,String cityName){
        this.cityId = cityId;
        this.cityName = cityName;
    }
}
